<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	    <meta name="viewport" content="width=device-width, initial-scale=1">
	    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
	    <title>网上祭奠</title>
	
	    <!-- Bootstrap -->
	    <link href="css/bootstrap.min.css" rel="stylesheet">
			<link href="css/jquery.mCustomScrollbar.css" rel="stylesheet">
			<link href="js/JBox/jBox.css" rel="stylesheet" />
			<link href="js/JBox/plugins/Notice/jBox.Notice.css"  rel="stylesheet"/>
			<link rel="stylesheet" href="css/index.css" />
	    <!--[if lt IE 9]>
	      <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
	      <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
	    <![endif]-->
	    
	    <script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
	    <script type="text/javascript" src="js/bootstrap.min.js"></script>
	    <script type="text/javascript" src="js/draggabilly.pkgd.js"></script>
	    <script type="text/javascript" src="js/jquery.mCustomScrollbar.js" ></script>
	    <script type="text/javascript" src="js/jquery.mCustomScrollbar.concat.min.js" ></script>
	    <script type="text/javascript" src="js/JBox/jBox.js" ></script>
	    <script type="text/javascript" src="js/JBox/plugins/Notice/jBox.Notice.js" ></script>
	    <script type="text/javascript" src="js/jquery.easing.1.3.js" ></script>
	    <script type="text/javascript" src="js/move-top.js" ></script>
    	<script type="text/javascript" src="js/jquery.cookie.js" ></script>
	    <script>
	    	if($.cookie("JP")==null||$.cookie("JP")=="null"){
    			window.location="Login.html";
    		}
	    	
	    	$(document).ready(function(){
	    		$().UItoTop({ easingType: 'easeOutQuart' });
	    		initMemorialBaseinfo($.getUrlParam("m"));
	    		initMemorialList($.getUrlParam("m"));
	    	});
	    	
	     	function crtTimeFtt(val, row) {
		    	if (val != null) {
		            var date = new Date(val);
		            return date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate();
		        }
			}
	     	
	     	(function ($) {
                $.getUrlParam = function (name) {
                    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
                    var r = window.location.search.substr(1).match(reg);
                    if (r != null) return unescape(r[2]); return null;
                }
        	})(jQuery);
	     	
	    	function initMemorialBaseinfo(id){
	    	$.ajax({
	          url: "/api/Memorial/GetMemorialinfo?mid="+id,
	          type: "GET",
	          dataType: "json", 
	          success: function (data) {	
				var dataObj=eval(data);
				var html="";
				var path=dataObj.Data[0]._mphotopath;
				if(path==""||path==null)
					path="img/unknown.png";
				var desc=dataObj.Data[0]._mresume;
				if(desc.length>30)
					desc=desc.substr(0,30);
				html+="<div class='Shrine-banner-face' style='background-image: url("+path+");'></div>";
				html+="<div class='Shrine-banner-desc'>";
				html+="<div class='Shrine-banner-comment' title='留言'></div>";
				if(dataObj.Data[0]._note3==$.cookie("JP")){
					html+="<div class='Shrine-banner-album' title='添加相册'></div>";
				}				
				html+="<h4>"+dataObj.Data[0]._mname+"</h4>";
				html+="<p style='height:1.2em;overflow:hidden;margin-bottom:5px'><span>"+dataObj.Data[0]._mage+"岁</span>";
				html+="<span> "+dataObj.Data[0]._birthaddress+"</span></p>";
				html+="<span>"+crtTimeFtt(dataObj.Data[0]._birthdate)+"-"+crtTimeFtt(dataObj.Data[0]._deathdate)+"</span>";
				html+="<p class='Shrine-banner-desc-section'>";
				html+=desc+" [查看简介]";
				html+="</p></div>";
				$(".index-title").text(dataObj.Data[0]._mname+"祭奠堂");	
				$(".Shrine-banner-content").html(html);											
           },
           error:function(XMLHttpRequest,textStatus,errorThrown)
           {
           	console.log(errorThrown);
           }
         });
	    }
	    
	    function initMemorialList(id){
	    	$.ajax({
	          url: "/api/Memorial/GetMemorialHallListByMid?mid="+id,
	          type: "GET",
	          dataType: "json", 
	          success: function (data) {	
				var dataObj=eval(data);
				var html="";
				for(var i=0;i<dataObj.Data.length;i++){
					var path=dataObj.Data[i]._mphotopath;
					if(path==""||path==null)
						path="img/unknown.png";
					var mhname=dataObj.Data[i]._mhname;
					if(mhname.length>6)
						mhname=mhname.substr(0,6)+"...";
					html+="<div class='col-lg-6 col-md-6 col-sm-12 col-xs-12 content-worship'>";
					html+="<a href='Worship.html?i="+dataObj.Data[i]._id+"'><div class='worship'>";
					html+="<div class='worship-face' style='background-image: url("+path+");'></div>";
					html+="<div class='worship-desc'>";
					html+="<h4 title='"+dataObj.Data[i]._mhname+"'>"+mhname+"</h4>";
					html+="<div style='margin-top:25px'><p>创建人："+dataObj.Data[i]._rightsname+"</p>";
					html+="<p>创建日期："+crtTimeFtt(dataObj.Data[i]._createtime)+"</p></div>";
					html+="<span>"+dataObj.Data[i]._note2+"</span>";
					if(dataObj.Data[i]._rightsid==$.cookie("JP")){
						html+="<div class='worship-desc-delete' title='删除'></div>";
						html+="<div class='worship-desc-edit' title='修改'></div>";
					}
					html+="</div></div></a></div>";
				}	
				$(".shrine-content").html(html);											
           },
           error:function(XMLHttpRequest,textStatus,errorThrown)
           {
           	console.log(errorThrown);
           }
         });
	    }
	    </script>
	</head>
	<body>
		<div class="index-top">
			<div class="index-shrineback" onclick="history.go(-1)"> </div>
			<span class="index-title">霍金祭奠堂</span>
			<div class="index-addshrine"><a href="NewShrine.html"> </a></div>
		</div>
		<div class="Shrine-banner">
			<div class="Shrine-banner-content"></div>
		</div>
		<div class="Shrine-menu">
			<div class="Shrine-menu-content">
				<div class="Shrine-menus">祭奠堂</div>
				<div class="Shrine-menus">传记</div>
				<div class="Shrine-menus">视频</div>
				<div class="Shrine-menus">音乐</div>
				<div class="Shrine-menus">文选</div>
				<div class="Shrine-menus">留言</div>
			</div>
		</div>
		<div class="shrine-content"></div>
		<div style="clear:both"></div>
		<div class="article-content">
			<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 content-article">
				<div class="article">
					<div class="article-face"></div>
					<div class="article-desc">
						<h4>霍金四大经典语录</h4>
						<p>2018-03-14</p>
						<span>于国军</span>
					</div>
				</div>
			</div>
		</div>
		<div class="toTop" href="#to-top" id="toTop">
				返回<br/>顶部
		</div>
	</body>
</html>
